<template>
    <div>
        <van-action-sheet v-model="show" @select="onSelect" :title="title">
			<ul class="mb">
				<li v-for="item,index of actions" :key="index" @click="actionsClick(item)">{{item.content}}</li>
			</ul>
		</van-action-sheet>
    </div>
</template>

<script>
import { Toast } from 'vant';
import { base } from './../utils/api';
export default {
    data(){
        return {
        	title: '密保问题',
            show: false,
			actions: []
        }
    },
    mounted(){
        this.getQuestions();
    },
    methods:{
        onShow(){
            this.show = true;
        },
        //密保问题
        getQuestions(){
            base.getQuestions().then(res => {
                if(res.code == 200){
                    this.actions = res.data;
                }else if(res.code == 1004){
                	this.title = res.msg;
                }
            })
        },
        onSelect(item) {
            // 点击选项时默认不会关闭菜单，可以手动关闭
            this.show = false;
        },
        actionsClick(item){
            this.show = false;
            this.$emit('change',item);
        }
    }
}
</script>

<style lang="less" scoped>
.mb{
    padding:10px;
    li{
        line-height: 46px;
        border-bottom:1px solid #ebedf0;
    }
}
</style>


